<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class alan extends CI_Controller
{
	public function __construct()
	{
        parent::__construct();
		//$this->load->model(array('general_model'));
		$this->load->model('user_model');
		$this->template->set_template('template/admin_template');
		ini_set('memory_limit', '-1');
		if($this->general_model->loggedin("admin") == FALSE)
		{
			redirect(ADMIN_PATH);
		}
    }
	public function send_mail($to,$subject,$message)
	{
		$settingdata=$this->general_model->select_val("setting","*","id = 1");
		$this->load->library('email');
		$this->email->set_mailtype("html");
		$this->email->set_newline("\r\n");
		$this->email->from($settingdata['notification_email'],$settingdata['site_name']);
		$this->email->reply_to($settingdata['notification_email'], $settingdata['site_name']);	
		$this->email->to($to);		
		$this->email->subject($subject);		
		$this->email->message($message);
	   $this->email->send();
	}
	public function pagination($totalrows,$baseurl,$perpage,$offset='')
	{
		$this->load->library('pagination');
		$data['query_string'] = ( ! empty($_SERVER['QUERY_STRING'])) ? '?' . $_SERVER['QUERY_STRING'] : '';
		// Create Pagination
		$config['base_url'] = $baseurl;
		$config['total_rows'] = $totalrows;
		$config['per_page'] = $perpage; 
		$config['uri_segment'] = '4';
		$config['num_links'] = 4 ;
		$config['full_tag_open'] = false;
		$config['full_tag_close'] = false;
		$config['cur_tag_open'] = '<a href="#">';
		$config['cur_tag_close'] = '</a>';
		$config['next_tag_open'] = false;
		$config['next_tag_close'] = false;
		$config['prev_tag_open'] = false;
		$config['prev_tag_close'] = false;
		$config['num_tag_open'] = false;
		$config['num_tag_close'] = false;
		$config['suffix'] = $data['query_string'];
		$this->pagination->initialize($config); 
		$pagination = $this->pagination->create_links();
		return $pagination;
	}
	public function index()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'Alan'));
		$filter = process_filter('alan');
		//print_r($filter);
		$search = array();
        if (isset($filter['search']))
        {
            $search['alan_name'] = $filter['search'];
           // unset($filter['search']);
        }
		if (isset($filter['status']))
        {
            if($filter['status']=="Paid")
             $search['status'] = "Paid";
			 else 
			  $search['status'] = "Free";
            //unset($filter['status']);
        }
		//print_r($filter);
		if ( ! empty($search))
        {
			if(isset($filter['search']) && isset($filter['status']))
			{
				$this->db->select("*");
				$this->db->from("alan_member");
				$this->db->where("account_status",$search['status']);
				$this->db->like("firstname",$search['alan_name']);
				$count = $this->db->count_all_results();
			}
			else if(isset($filter['search']))
			{
				$this->db->select("*");
				$this->db->from("alan_member");
				$this->db->like("firstname",$search['alan_name']);
				$count = $this->db->count_all_results();
			//$data['totalbusiness']  = $this->db->get()->result_array();
			}
			else if(isset($filter['status']))
			{
				$this->db->select("*");
				$this->db->from("alan_member");
				$this->db->where("account_status",$search['status']);
				$count = $this->db->count_all_results();
			}
        }
		else
		{
			$count=$this->general_model->count_row("alan_member");
		}
		//$data['totalalan'] = $this->general_model->select('alan');
		//$count=count($data['totalalan']);
		//echo $count;
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/index/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		if ( ! empty($search))
        {
			if(isset($filter['search']) && isset($filter['status']))
			{
				$this->db->select("*");
				$this->db->from("alan_member");
				$this->db->order_by('userid','ASC');
				$this->db->where("account_status",$search['status']);
				$this->db->like("firstname",$search['alan_name']);
				$this->db->limit($perpage,$offset);
				$data['alanmembers']  = $this->db->get()->result_array();
			}
			else if(isset($filter['search']))
			{
				$this->db->select("*");
				$this->db->from("alan_member");
				$this->db->order_by('userid','ASC');
				$this->db->like("firstname",$search['alan_name']);
				$this->db->limit($perpage,$offset);
				$data['alanmembers']  = $this->db->get()->result_array();
			}
			else if(isset($filter['status']))
			{
				$this->db->select("*");
				$this->db->from("alan_member");
				$this->db->order_by('userid','ASC');
				$this->db->where("account_status",$search['status']);
				$this->db->limit($perpage,$offset);
				$data['alanmembers']  = $this->db->get()->result_array();
			}
        }
		else{
		$data['alanmembers'] = $this->general_model->select_rows("alan_member","*","id","asc",$perpage,$offset);
		}
		$i=0;
		foreach($data['alanmembers'] as $member)
		{
			$data['alanmembers'][$i]['new_message']=$this->general_model->count_row("alan_messagebox","toid =".$member['userid']. " and approve ='Processing'");
			$i++;
		}
		/* echo "<pre>";
		print_r($data['alanmembers']); */
		$this->template->content->view('admin/alan/allalan', $data);
		$this->template->publish();
	}
	public function editalan()
	{
		$data['breadcrumb'] = set_crumbs(array('alan' => 'All Alan', current_url() => 'Edit Alan'));
		$userid=$this->uri->segment(4);
		/*$rulesmember = $this->general_model->rules_updatejoin;
		$this->form_validation->set_rules($rulesmember);
		if ($this->form_validation->run() == TRUE)*/
		
		if($this->input->server('REQUEST_METHOD') === 'POST')
        {
			/*echo "<pre>";
			print_r($_POST);
			exit;*/
			$userdata=array(
				"firstname"=>$this->input->post('firstname'),
				"lastname"=>$this->input->post('lastname'),
				
				
				"phoneno"=>$this->input->post('phoneno'),
				"address"=>$this->input->post('address'),
				"city"=>$this->input->post('city'),
				"state_id"=>$this->input->post('state_id'),
				"state"=>$this->input->post('state'),
				"country_id"=>$this->input->post('country_id'),
				"country"=>$this->input->post('country'),
				"zip"=>$this->input->post('zip'),
				
				"date_modified"=>date('Y-m-d H:i:s')
			);
			
			$this->general_model->update('users',$userdata,'userid ='.$userid);
			$alan_data=array(
					"firstname"=>$this->input->post('firstname'),
					"lastname"=>$this->input->post('lastname'),
					"account_type"=>$this->input->post('account_type'),
					"gender"=>$this->input->post('gender'),
					
					"photo"=>$this->input->post('photo'),
					"dob"=>$this->input->post('dob'),
					"refered_by"=>$this->input->post('refered_by'),
					"height"=>$this->input->post('height'),
					"address"=>$this->input->post('address'),
					"country_id"=>$this->input->post('country_id'),
					"country"=>$this->input->post('country'),
					"state_id"=>$this->input->post('state_id'),
					"state"=>$this->input->post('state'),
					"city"=>$this->input->post('city'),
					"zip"=>$this->input->post('zip'),
					"phoneno"=>$this->input->post('phoneno'),
					"marital_status"=>$this->input->post('marital_status'),
					"mother_tongue"=>$this->input->post('mother_tongue'),
					"religion"=>$this->input->post('religion'),
					"ethnicity"=>$this->input->post('ethnicity'),
					"relationship"=>$this->input->post('relationship'),
					"skin_type"=>$this->input->post('skin_type'),
					"body_type"=>$this->input->post('body_type'),
					"eye_color"=>$this->input->post('eye_color'),
					"looking_meet"=>$this->input->post('looking_meet'),
					"diet"=>$this->input->post('diet'),
					"smoke"=>$this->input->post('smoke'),
					"drink"=>$this->input->post('drink'),
					"community"=>$this->input->post('community'),
					"sub_community"=>$this->input->post('sub_community'),
					"annual_income"=>$this->input->post('annual_income'),
					"education_level"=>$this->input->post('education_level'),
					"education_field"=>$this->input->post('education_field'),
					"working_with"=>$this->input->post('working_with'),
					"working_as"=>$this->input->post('working_as'),
					"about_yourself"=>$this->input->post('about_yourself'),
					"disability"=>$this->input->post('disability'),
					"place_visit"=>$this->input->post('place_visit'),
					"interested_in"=>($this->input->post('interested_in') ? implode(',',$this->input->post('interested_in')) : ''),
					"about_travelpartner"=>$this->input->post('about_travelpartner'),
					"is_profile"=>1,
					
					
			);
			$alanid=$this->general_model->update('alan_member',$alan_data,'userid ='.$userid);
			$this->general_model->delete_row("alan_photo","userid =".$userid);
		
			if ($this->input->post('additional_photo')) {
				foreach ($this->input->post('additional_photo') as $additional_photo) {
					$alanphoto=array(
						"userid"=>$userid,
						"photo"=>$additional_photo,
						"date_added"=>date('Y-m-d')
					);
					$this->general_model->insert('alan_photo',$alanphoto);
				}
			}
			
			
			
			$this->session->set_flashdata('message', '<p class="success">Update successfully</p>');
			redirect(ADMIN_PATH . '/alan');
		}
		$data['alan']=$this->general_model->get_join2table("alan_member","users","*,alan_member.country,alan_member.state,alan_member.city,alan_member.email","alan_member.userid=users.userid","alan_member.userid = ".$userid);
		$data['referred'] = $this->general_model->select('alan_referred_by');
		$data['allheight'] = $this->general_model->select('alan_height');
		$data['allskin'] = $this->general_model->select('alan_skin_type');
		$data['allbodytype'] = $this->general_model->select('alan_body_type');
		$data['alleyecolor'] = $this->general_model->select('alan_eye_color');
		$data['countries'] = $this->general_model->select("country");
		$data['states'] = $this->general_model->select("zone");
		$data['maritalstatus'] = $this->general_model->select("alan_marital_status");
		$data['mothertongue'] = $this->general_model->select("alan_mother_tongue");
		$data['allethnicity'] = $this->general_model->select("alan_ethnicity");
		$data['allrelationship'] = $this->general_model->select("alan_relationship");
		$data['allreligion'] = $this->general_model->select("alan_religion");
		$data['alldiet'] = $this->general_model->select("alan_diet");
		$data['alldrink'] = $this->general_model->select("alan_drink");
		$data['allsmoke'] = $this->general_model->select("alan_smoke");
		$data['educationlevel'] = $this->general_model->select("alan_education_level");
		$data['educationfield'] = $this->general_model->select("alan_education_field");
		$data['workingwith'] = $this->general_model->select("alan_working_with");
		$data['workingas'] = $this->general_model->select("alan_occupation");
		$data['allcommunity'] = $this->general_model->select("alan_community");
		$data['annualincome'] = $this->general_model->select("alan_annual_income");
		$data['lookingmeet'] = $this->general_model->select("alan_looking_meet");
		$data['allinterested'] = $this->general_model->select("alan_interested_in");
		
		/*echo "<pre>";
		print_r($data['alan']);*/
		if (isset($_POST['firstname'])) {
      		$data['firstname'] = $_POST['firstname'];
    	} elseif (isset($data['alan']['firstname'])) {
			$data['firstname'] = $data['alan']['firstname'];
		} else {
      		$data['firstname'] = '';
    	}
		if (isset($_POST['lastname'])) {	
      		$data['lastname'] = $_POST['lastname'];
    	}elseif (isset($data['alan']['lastname'])) {
			$data['lastname'] = $data['alan']['lastname'];
		}  else {
      		$data['lastname'] = '';
    	}
		if (isset($_POST['gender'])) {
      		$data['gender'] = $_POST['gender'];
    	} elseif (isset($data['alan']['gender'])) {
			$data['gender'] = $data['alan']['gender'];
		} else {
      		$data['gender'] = '';
    	}
		if (isset($_POST['dob'])) {
      		$data['dob'] = $_POST['dob'];
    	} elseif (isset($data['alan']['dob'])) {
			$data['dob'] = $data['alan']['dob'];
		} else {
      		$data['dob'] = '';
    	}
		if (isset($_POST['refered_by'])) {
      		$data['refered_by'] = $_POST['refered_by'];
    	} elseif (isset($data['alan']['refered_by'])) {
			$data['refered_by'] = $data['alan']['refered_by'];
		} else {
      		$data['refered_by'] = '';
    	}
		if (isset($_POST['height'])) {
      		$data['height'] = $_POST['height'];
    	} elseif (isset($data['alan']['height'])) {
			$data['height'] = $data['alan']['height'];
		} else {
      		$data['height'] = '';
    	}
		if (isset($_POST['skin_type'])) {
      		$data['skin_type'] = $_POST['skin_type'];
    	} elseif (isset($data['alan']['skin_type'])) {
			$data['skin_type'] = $data['alan']['skin_type'];
		} else {
      		$data['skin_type'] = '';
    	}
		if (isset($_POST['body_type'])) {
      		$data['body_type'] = $_POST['body_type'];
    	} elseif (isset($data['alan']['body_type'])) {
			$data['body_type'] = $data['alan']['body_type'];
		} else {
      		$data['body_type'] = '';
    	}
		if (isset($_POST['eye_color'])) {
      		$data['eye_color'] = $_POST['eye_color'];
    	} elseif (isset($data['alan']['eye_color'])) {
			$data['eye_color'] = $data['alan']['eye_color'];
		} else {
      		$data['eye_color'] = '';
    	}
		if (isset($_POST['photo'])) {
      		$data['photo'] = $_POST['photo'];
    	} elseif (isset($data['alan']['photo'])) {
			$data['photo'] = $data['alan']['photo'];
		} else {
      		$data['photo'] = '';
    	}
		//echo $data['photo'];
		if (isset($_POST['photo'])) {
			$data['thumb'] = base_url('assets/uploads/.thumbs/images/alan').'/'.$_POST['photo'];
		}elseif (!empty($data['alan']['photo'])) {
			$data['thumb'] = base_url('assets/uploads/.thumbs/images/alan').'/'.$data['alan']['photo'];
		}  else {
			$data['thumb'] = base_url('assets/uploads/.thumbs/images/alan').'/'. DEFAULT_IMG;
		}
		if (isset($_POST['address'])) {
      		$data['address'] = $_POST['address'];
    	}elseif (isset($data['alan']['address'])) {
			$data['address'] = $data['alan']['address'];
		}  else {
      		$data['address'] = '';
    	}
		if (isset($_POST['country_id'])) {
      		$data['country_id'] = $_POST['country_id'];
    	}elseif (isset($data['alan']['country_id'])) {
			$data['country_id'] = $data['alan']['country_id'];
		}  else {
      		$data['country_id'] = '';
    	}
		if (isset($_POST['state_id'])) {
      		$data['state_id'] = $_POST['state_id'];
    	}elseif (isset($data['alan']['state_id'])) {
			$data['state_id'] = $data['alan']['state_id'];
		}  else {
      		$data['state_id'] = '';
    	}
		if (isset($_POST['city'])) {
      		$data['city'] = $_POST['city'];
    	}elseif (isset($data['alan']['city'])) {
			$data['city'] = $data['alan']['city'];
		}  else {
      		$data['city'] = '';
    	}
		if (isset($_POST['zip'])) {
      		$data['zip'] = $_POST['zip'];
    	}elseif (isset($data['alan']['zip'])) {
			$data['zip'] = $data['alan']['zip'];
		}  else {
      		$data['zip'] = '';
    	}
		if (isset($_POST['phoneno'])) {
      		$data['phoneno'] = $_POST['phoneno'];
    	}elseif (isset($data['alan']['phoneno'])) {
			$data['phoneno'] = $data['alan']['phoneno'];
		} else {
      		$data['phoneno'] = '';
    	}
		if (isset($_POST['marital_status'])) {
      		$data['marital_status'] = $_POST['marital_status'];
    	}elseif (isset($data['alan']['marital_status'])) {
			$data['marital_status'] = $data['alan']['marital_status'];
		} else {
      		$data['marital_status'] = '';
    	}
		if (isset($_POST['mother_tongue'])) {
      		$data['mother_tongue'] = $_POST['mother_tongue'];
    	}elseif (isset($data['alan']['mother_tongue'])) {
			$data['mother_tongue'] = $data['alan']['mother_tongue'];
		} else {
      		$data['marital_status'] = '';
    	}
		if (isset($_POST['ethnicity'])) {
      		$data['alanethnicity'] = $_POST['ethnicity'];
    	}elseif (isset($data['alan']['ethnicity'])) {
			$data['alanethnicity'] = $data['alan']['ethnicity'];
		} else {
      		$data['alanethnicity'] = '';
    	}
		if (isset($_POST['relationship'])) {
      		$data['alanrelationship'] = $_POST['relationship'];
    	}elseif (isset($data['alan']['relationship'])) {
			$data['alanrelationship'] = $data['alan']['relationship'];
		} else {
      		$data['alanrelationship'] = '';
    	}
		if (isset($_POST['religion'])) {
      		$data['alanreligion'] = $_POST['religion'];
    	}elseif (isset($data['alan']['religion'])) {
			$data['alanreligion'] = $data['alan']['religion'];
		} else {
      		$data['alanreligion'] = '';
    	}
		if (isset($_POST['diet'])) {
      		$data['alandiet'] = $_POST['diet'];
    	}elseif (isset($data['alan']['diet'])) {
			$data['alandiet'] = $data['alan']['diet'];
		} else {
      		$data['alandiet'] = '';
    	}
		if (isset($_POST['drink'])) {
      		$data['alandrink'] = $_POST['drink'];
    	}elseif (isset($data['alan']['drink'])) {
			$data['alandrink'] = $data['alan']['drink'];
		} else {
      		$data['alandrink'] = '';
    	}
		if (isset($_POST['smoke'])) {
      		$data['alansmoke'] = $_POST['smoke'];
    	}elseif (isset($data['alan']['smoke'])) {
			$data['alansmoke'] = $data['alan']['smoke'];
		} else {
      		$data['alansmoke'] = '';
    	}
		if (isset($_POST['education_level'])) {
      		$data['education_level'] = $_POST['education_level'];
    	}elseif (isset($data['alan']['education_level'])) {
			$data['education_level'] = $data['alan']['education_level'];
		} else {
      		$data['education_level'] = '';
    	}
		if (isset($_POST['education_field'])) {
      		$data['education_field'] = $_POST['education_field'];
    	}elseif (isset($data['alan']['education_field'])) {
			$data['education_field'] = $data['alan']['education_field'];
		} else {
      		$data['education_field'] = '';
    	}
		if (isset($_POST['working_with'])) {
      		$data['working_with'] = $_POST['working_with'];
    	}elseif (isset($data['alan']['working_with'])) {
			$data['working_with'] = $data['alan']['working_with'];
		} else {
      		$data['working_with'] = '';
    	}
		if (isset($_POST['working_as'])) {
      		$data['working_as'] = $_POST['working_as'];
    	}elseif (isset($data['alan']['working_as'])) {
			$data['working_as'] = $data['alan']['working_as'];
		} else {
      		$data['working_as'] = '';
    	}
		if (isset($_POST['community'])) {
      		$data['community'] = $_POST['community'];
    	}elseif (isset($data['alan']['community'])) {
			$data['community'] = $data['alan']['community'];
		} else {
      		$data['community'] = '';
    	}
		if (isset($_POST['sub_community'])) {
      		$data['sub_community'] = $_POST['sub_community'];
    	}elseif (isset($data['alan']['sub_community'])) {
			$data['sub_community'] = $data['alan']['sub_community'];
		} else {
      		$data['sub_community'] = '';
    	}
		if (isset($_POST['annual_income'])) {
      		$data['annual_income'] = $_POST['annual_income'];
    	}elseif (isset($data['alan']['annual_income'])) {
			$data['annual_income'] = $data['alan']['annual_income'];
		} else {
      		$data['annual_income'] = '';
    	}
		if (isset($_POST['about_yourself'])) {
      		$data['about_yourself'] = $_POST['about_yourself'];
    	}elseif (isset($data['alan']['about_yourself'])) {
			$data['about_yourself'] = $data['alan']['about_yourself'];
		} else {
      		$data['about_yourself'] = '';
    	}
		if (isset($_POST['disability'])) {
      		$data['disability'] = $_POST['disability'];
    	}elseif (isset($data['alan']['disability'])) {
			$data['disability'] = $data['alan']['disability'];
		} else {
      		$data['disability'] = '';
    	}
		if (isset($_POST['place_visit'])) {
      		$data['place_visit'] = $_POST['place_visit'];
    	}elseif (isset($data['alan']['place_visit'])) {
			$data['place_visit'] = $data['alan']['place_visit'];
		} else {
      		$data['place_visit'] = '';
    	}
		if (isset($_POST['interested_in'])) {
      		$data['interested_in'] = $_POST['interested_in'];
    	}elseif (isset($data['alan']['interested_in'])) {
			$data['interested_in'] = explode(',',$data['alan']['interested_in']);
		} else {
      		$data['interested_in'] = array();
    	}
		if (isset($_POST['looking_meet'])) {
      		$data['looking_meet'] = $_POST['looking_meet'];
    	}elseif (isset($data['alan']['looking_meet'])) {
			$data['looking_meet'] = $data['alan']['looking_meet'];
		} else {
      		$data['looking_meet'] = '';
    	}
		if (isset($_POST['about_travelpartner'])) {
      		$data['about_travelpartner'] = $_POST['about_travelpartner'];
    	}elseif (isset($data['alan']['about_travelpartner'])) {
			$data['about_travelpartner'] = $data['alan']['about_travelpartner'];
		} else {
      		$data['about_travelpartner'] = '';
    	}
		if (isset($_POST['additional_photo'])) {
			$data['additional_photo'] = $_POST['additional_photo'];
		}elseif (isset($data['alan']['userid'])) {
			$data['additional_photo'] = $this->general_model->select('alan_photo','*','userid = '.$data['alan']['userid']);
		}else {
			$data['additional_photo'] = array();
		}
		/*echo "<pre>";
		print_r($data['additional_photo']);
		exit;*/
		/*if (isset($_POST['status'])) {
      		$data['activated'] = $_POST['status'];
    	}elseif (isset($data['alan']['activated'])) {
			$data['activated'] = $data['alan']['activated'];
		}  else {
      		$data['activated'] = '';
    	}
		//echo $data['status'];
		if (isset($_POST['email'])) {
      		$data['email'] = $_POST['email'];
    	}elseif (isset($data['alan']['email'])) {
			$data['email'] = $data['alan']['email'];
		}  else {
      		$data['email'] = '';
    	}
		if (isset($_POST['show_password'])) {
      		$data['show_password'] = $_POST['show_password'];
    	}elseif (isset($data['alan']['show_password'])) {
			$data['show_password'] = $data['alan']['show_password'];
		}  else {
      		$data['show_password'] = '';
    	}
		if (isset($_POST['account_type'])) {
      		$data['account_type'] = $_POST['account_type'];
    	}elseif (isset($data['alan']['account_type'])) {
			$data['account_type'] = $data['alan']['account_type'];
		}  else {
      		$data['account_type'] = '';
    	}*/
		//print_r($data['activated']);
		//$data['locations'] = $this->general_model->select("location");
		//$data['practices'] = $this->general_model->select("practices");
		$this->template->content->view('admin/alan/alanform', $data);
		$this->template->publish();
	}
	public function deletealan()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('users','userid',$selected);
		$this->general_model->delete_rows('alan_member','userid',$selected);
		$this->general_model->delete_rows('alan_profileview_history','profileid',$selected);
		$this->general_model->delete_rows('alan_profileview_history','viewerid',$selected);
		$this->general_model->delete_rows('alan_profile_like','profileid',$selected);
		$this->general_model->delete_rows('alan_profile_like','likerid',$selected);
		$this->general_model->delete_rows('alan_trip_suggestion','toid',$selected);
		$this->general_model->delete_rows('alan_trip_suggestion','fromid',$selected);
		$this->general_model->delete_rows('alan_messagebox','toid',$selected);
		$this->general_model->delete_rows('alan_messagebox','fromid',$selected);
		foreach($selected as $id)
		{
			$fileinfo=$this->general_model->select("alan_photo","photo","userid =".$id);
			foreach($fileinfo as $photo)
			{
				unlink(FCPATH.'assets/uploads/images/alan/'.urldecode($photo['photo']));
			}
		}
		$this->general_model->delete_rows('alan_photo','userid',$selected);
		$this->session->set_flashdata('message', '<p class="success">Member deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan");
	}
	public function alansetting()
	{
		$data['breadcrumb'] = set_crumbs(array('alan' => 'All Alan', current_url() => 'Alan Account'));
		$userid=$this->uri->segment(4);
		if($this->input->server('REQUEST_METHOD') === 'POST')
        {
			/*echo "<pre>";
			print_r($_POST);
			exit;*/
			$userdata=array(
				
				"email"=>$this->input->post('email'),
				"password"=>md5($this->input->post('show_password')),
				"show_password"=>$this->input->post('show_password'),
				"activated"=>$this->input->post('status'),
				
			);
			
			$this->general_model->update('users',$userdata,'userid ='.$userid);
			$alan_data=array(
					"account_type"=>$this->input->post('account_type'),
					"email"=>$this->input->post('email'),
					"activated"=>$this->input->post('status'),
					"account_balance"=>$this->input->post('account_balance'),
					"no_of_message"=>$this->input->post('no_of_message'),
					"account_status"=>$this->input->post('account_status'),
					"valid_date"=>date("Y-m-d",strtotime($this->input->post('valid_date')))
			);
			$alanid=$this->general_model->update('alan_member',$alan_data,'userid ='.$userid);
	
			$this->session->set_flashdata('message', '<p class="success">Account Update successfully</p>');
			redirect(ADMIN_PATH . '/alan/alansetting/'.$userid);
		}
		$data['alan']=$this->general_model->get_join2table("alan_member","users","*,alan_member.country,alan_member.state,alan_member.city,alan_member.email","alan_member.userid=users.userid","alan_member.userid = ".$userid);
		if (isset($_POST['status'])) {
      		$data['activated'] = $_POST['status'];
    	}elseif (isset($data['alan']['activated'])) {
			$data['activated'] = $data['alan']['activated'];
		}  else {
      		$data['activated'] = '';
    	}
		//echo $data['status'];
		if (isset($_POST['email'])) {
      		$data['email'] = $_POST['email'];
    	}elseif (isset($data['alan']['email'])) {
			$data['email'] = $data['alan']['email'];
		}  else {
      		$data['email'] = '';
    	}
		if (isset($_POST['show_password'])) {
      		$data['show_password'] = $_POST['show_password'];
    	}elseif (isset($data['alan']['show_password'])) {
			$data['show_password'] = $data['alan']['show_password'];
		}  else {
      		$data['show_password'] = '';
    	}
		
		if (isset($_POST['account_type'])) {
      		$data['account_type'] = $_POST['account_type'];
    	}elseif (isset($data['alan']['account_type'])) {
			$data['account_type'] = $data['alan']['account_type'];
		}  else {
      		$data['account_type'] = '';
    	}
		
		if (isset($_POST['account_status'])) {
      		$data['account_status'] = $_POST['account_status'];
    	}elseif (isset($data['alan']['account_status'])) {
			$data['account_status'] = $data['alan']['account_status'];
		}  else {
      		$data['account_status'] = '';
    	}
		
		if (isset($_POST['valid_date'])) {
      		$data['valid_date'] = $_POST['valid_date'];
    	}elseif (isset($data['alan']['valid_date'])) {
			$data['valid_date'] = $data['alan']['valid_date'];
		}  else {
      		$data['valid_date'] = '';
    	}
		
		if (isset($_POST['account_balance'])) {
      		$data['account_balance'] = $_POST['account_balance'];
    	}elseif (isset($data['alan']['account_balance'])) {
			$data['account_balance'] = $data['alan']['account_balance'];
		}  else {
      		$data['account_balance'] = '';
    	}
		
		if (isset($_POST['no_of_message'])) {
      		$data['no_of_message'] = $_POST['no_of_message'];
    	}elseif (isset($data['alan']['no_of_message'])) {
			$data['no_of_message'] = $data['alan']['no_of_message'];
		}  else {
      		$data['no_of_message'] = '';
    	}
		
		$this->template->content->view('admin/alan/alanaccountsetting', $data);
		$this->template->publish();
		
	}
	public function alanmessage()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'Alan Message'));
		$userid=$this->uri->segment(4);
		$filter = process_filter('alan_messagebox');
		//print_r($filter);
		$search = array();
        if (isset($filter['approve']))
        {
            $search['approve'] = $filter['approve'];
           // unset($filter['search']);
        }
		if (isset($filter['openstatus']))
        {
           
             $search['openstatus'] = $filter['openstatus'];
			
        }
		//print_r($filter['approve']);
		if ( ! empty($search))
        {
			if(isset($filter['approve']) && isset($filter['openstatus']))
			{
				
				
				
				//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
				$this->db->from('alan_messagebox');
				//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
				$this->db->where('alan_messagebox.toid ='.$userid);
				$this->db->where("alan_messagebox.approve",$search['approve']);
				$this->db->where("alan_messagebox.openstatus",$search['openstatus']);
				
				$count = $this->db->count_all_results();
				
			}
			else if(isset($filter['approve']))
			{
				
				
				
				//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
				$this->db->from('alan_messagebox');
				//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
				$this->db->where('alan_messagebox.toid ='.$userid);
				$this->db->where("alan_messagebox.approve",$search['approve']);
				
				$count = $this->db->count_all_results();
			}
			else if(isset($filter['openstatus']))
			{
				
				
				
				//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
				$this->db->from('alan_messagebox');
				//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
				$this->db->where('alan_messagebox.toid ='.$userid);
				$this->db->where("alan_messagebox.openstatus",$search['openstatus']);
				
				$count = $this->db->count_all_results();
			}
        }
		else
		{
			$count=$this->general_model->count_row('alan_messagebox','toid ='.$userid );
		
		
		}

		//$data['totalalan'] = $this->general_model->select('alan');
		//$count=count($data['totalalan']);
		//echo $count;
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/index/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		if ( ! empty($search))
        {
			if(isset($filter['approve']) && isset($filter['openstatus']))
			{

				//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
				$this->db->from('alan_messagebox');
				//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
				$this->db->where('alan_messagebox.toid ='.$userid);
				$this->db->where("alan_messagebox.approve",$search['approve']);
				$this->db->where("alan_messagebox.openstatus",$search['openstatus']);
				$this->db->limit($perpage,$offset);
				$data['inbox']  = $this->db->get()->result_array();
			}
			else if(isset($filter['approve']))
			{
				
				
				//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
				$this->db->from('alan_messagebox');
				//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
				$this->db->where('alan_messagebox.toid ='.$userid);
				$this->db->where("alan_messagebox.approve",$search['approve']);
				$this->db->limit($perpage,$offset);
				$data['inbox']  = $this->db->get()->result_array();
			}
			else if(isset($filter['openstatus']))
			{
				
				//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
				$this->db->from('alan_messagebox');
				//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
				$this->db->where('alan_messagebox.toid ='.$userid);
				$this->db->where("alan_messagebox.openstatus",$search['openstatus']);
				$this->db->limit($perpage,$offset);
				$data['inbox']  = $this->db->get()->result_array();
			}
        }
		else
		{
			//$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_messagebox.*');
			$this->db->from('alan_messagebox');
			//$this->db->join('alan_member', 'alan_member.userid=alan_messagebox.fromid');
			$this->db->where('alan_messagebox.toid ='.$userid);
			
			$this->db->limit($perpage,$offset);
			$data['inbox'] = $this->db->get()->result_array();
		}
		$i=0;
		foreach($data['inbox'] as $inbox)
		{
			$fromname=$this->general_model->select_val('alan_member','firstname,lastname','userid ='.$inbox['fromid']);
			$toname=$this->general_model->select_val('alan_member','firstname,lastname','userid ='.$inbox['toid']);
			$data['inbox'][$i]['fromname']=$fromname['firstname'].' '.$fromname['lastname'];
			$data['inbox'][$i]['toname']=$toname['firstname'].' '.$toname['lastname'];
			$i++;
		}
		
		$this->template->content->view('admin/alan/alanmessage', $data);
		$this->template->publish();
	}
	public function deletmessage($userid)
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_messagebox','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Message deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/alanmessage/".$userid);
	}
	public function allevent()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Event'));
		$filter = process_filter('alan_event');
		//print_r($filter);
		$search = array();
        if (isset($filter['search']))
        {
            $search['alan_name'] = $filter['search'];
           // unset($filter['search']);
        }
		if (isset($filter['approve']))
        {
           
             $search['approve'] = $filter['approve'];
			
        }
		//print_r($filter['approve']);
		if ( ! empty($search))
        {
			if(isset($filter['search']) && isset($filter['approve']))
			{
				
				$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
				$this->db->from('alan_event');
				$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
				$this->db->where("alan_event.approve",$search['approve']);
				$this->db->like("alan_member.firstname",$search['alan_name']);
				$count = $this->db->count_all_results();
			}
			else if(isset($filter['search']))
			{
				
				$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
				$this->db->from('alan_event');
				$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
				
				$this->db->like("alan_member.firstname",$search['alan_name']);
				$count = $this->db->count_all_results();
			}
			else if(isset($filter['approve']))
			{
				
				$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
				$this->db->from('alan_event');
				$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
				$this->db->where("alan_event.approve",$search['approve']);
				$count = $this->db->count_all_results();
			}
        }
		else
		{
			$count=$this->general_model->count_row("alan_event");
		}

		//$data['totalalan'] = $this->general_model->select('alan');
		//$count=count($data['totalalan']);
		//echo $count;
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/index/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		if ( ! empty($search))
        {
			if(isset($filter['search']) && isset($filter['status']))
			{

				$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
				$this->db->from('alan_event');
				$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
				$this->db->where("alan_event.approve",$search['approve']);
				$this->db->like("alan_member.firstname",$search['alan_name']);
				$this->db->limit($perpage,$offset);
				$data['alanevent']  = $this->db->get()->result_array();
			}
			else if(isset($filter['search']))
			{
				
				
				$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
				$this->db->from('alan_event');
				$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
				$this->db->like("alan_member.firstname",$search['alan_name']);
				$this->db->limit($perpage,$offset);
				$data['alanevent']  = $this->db->get()->result_array();
			}
			else if(isset($filter['approve']))
			{
				
				$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
				$this->db->from('alan_event');
				$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
				$this->db->where("alan_event.approve",$search['approve']);
				$this->db->limit($perpage,$offset);
				$data['alanevent']  = $this->db->get()->result_array();
			}
        }
		else
		{
			$this->db->select('alan_member.firstname,alan_member.lastname,alan_member.userid,alan_member.gender,alan_member.email,alan_event.*');
			$this->db->from('alan_event');
			$this->db->join('alan_member', 'alan_member.userid=alan_event.userid');
			
			$this->db->limit($perpage,$offset);
			$data['alanevent'] = $this->db->get()->result_array();
		}
		
		/* echo "<pre>";
		print_r($data['alanmembers']); */
		$this->template->content->view('admin/alan/allevent', $data);
		$this->template->publish();
	}
	public function deleteevent()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(4);
        }
		$this->general_model->delete_rows('alan_event','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Event deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/allevent");
	}
	/*Basic setting*/
	public function referred()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Referred By'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$referreddata=array("name"=>$this->input->post('referred'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_referred_by",$referreddata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_referred_by",$referreddata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/referred");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['referrededitdata']=$this->general_model->select_val("alan_referred_by","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_referred_by");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/referred/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['referred'] = $this->general_model->select_rows('alan_referred_by','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/referred', $data);
		$this->template->publish();
	}
	public function deletereferred()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_referred_by','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Referred by deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/referred");
	}
	public function height()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All height'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$heightdata=array("name"=>$this->input->post('height'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_height",$heightdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_height",$heightdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/height");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['heighteditdata']=$this->general_model->select_val("alan_height","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_height");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/height/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['height'] = $this->general_model->select_rows('alan_height','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/height', $data);
		$this->template->publish();
	}
	public function deleteheight()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_height','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">height deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/height");
	}
	public function skintype()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Skin Type'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$skindata=array("name"=>$this->input->post('skintype'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_skin_type",$skindata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_skin_type",$skindata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/skintype");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['skineditdata']=$this->general_model->select_val("alan_skin_type","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_skin_type");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/skintype/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['skintype'] = $this->general_model->select_rows('alan_skin_type','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/skintype', $data);
		$this->template->publish();
	}
	public function deleteskintype()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_skin_type','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Skin Type deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/bodytype");
	}
	public function bodytype()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Body Type'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$bodydata=array("name"=>$this->input->post('bodytype'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_body_type",$bodydata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_body_type",$bodydata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/bodytype");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['bodyeditdata']=$this->general_model->select_val("alan_body_type","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_body_type");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/bodytype/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['bodytype'] = $this->general_model->select_rows('alan_body_type','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/bodytype', $data);
		$this->template->publish();
	}
	public function deletebodytype()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_body_type','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Body Type deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/bodytype");
	}
	public function eyecolor()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All eye color'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$eyedata=array("name"=>$this->input->post('eyecolor'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_eye_color",$eyedata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_eye_color",$eyedata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/eyecolor");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['eyeeditdata']=$this->general_model->select_val("alan_eye_color","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_eye_color");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/eyecolor/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['eyecolor'] = $this->general_model->select_rows('alan_eye_color','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/eyecolor', $data);
		$this->template->publish();
	}
	public function deleteeyecolor()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_eye_color','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">eye color deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/eyecolor");
	}
	/*End Basic Setting */
	/*Social Setting*/
	public function maritalstatus()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Marital Status'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$maritaldata=array("name"=>$this->input->post('maritalstatus'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_marital_status",$maritaldata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_marital_status",$maritaldata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/maritalstatus");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['maritaleditdata']=$this->general_model->select_val("alan_marital_status","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_marital_status");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/maritalstatus/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['maritalstatus'] = $this->general_model->select_rows('alan_marital_status','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/maritalstatus', $data);
		$this->template->publish();
	}
	public function deletemaritalstatus()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_marital_status','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Marital Status deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/maritalstatus");
	}
	public function mothertongue()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Mother Tongue'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$mothertonguedata=array("name"=>$this->input->post('mothertongue'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_mother_tongue",$mothertonguedata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_mother_tongue",$mothertonguedata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/mothertongue");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['mothertongueeditdata']=$this->general_model->select_val("alan_mother_tongue","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_mother_tongue");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/mothertongue/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['mothertongue'] = $this->general_model->select_rows('alan_mother_tongue','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/mothertongue', $data);
		$this->template->publish();
	}
	public function deletemothertongue()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_mother_tongue','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Mother Tongue deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/mothertongue");
	}
	public function ethnicity()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Ethnicity'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$ethnicitydata=array(
							"name"=>$this->input->post('ethnicity'));
			//print_r($ethnicitydata);
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_ethnicity",$ethnicitydata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_ethnicity",$ethnicitydata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/ethnicity");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['ethnicityeditdata']=$this->general_model->select_val("alan_ethnicity","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_ethnicity");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/ethnicity/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['ethnicity'] = $this->general_model->select_rows('alan_ethnicity','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/ethnicity', $data);
		$this->template->publish();
	}
	public function deleteethnicity()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_ethnicity','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Ethnicity deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/ethnicity");
	}
	public function religion()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Religion'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$religiondata=array("name"=>$this->input->post('religion'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_religion",$religiondata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_religion",$religiondata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/religion");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['religioneditdata']=$this->general_model->select_val("alan_religion","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_religion");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/religion/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['religion'] = $this->general_model->select_rows('alan_religion','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/religion', $data);
		$this->template->publish();
	}
	public function deletereligion()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_religion','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Religion deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/religion");
	}
	public function relationship()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Relationship'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$relationshipdata=array("name"=>$this->input->post('relationship'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_relationship",$relationshipdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_relationship",$relationshipdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/relationship");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['relationshipeditdata']=$this->general_model->select_val("alan_relationship","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_relationship");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/relationship/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['relationship'] = $this->general_model->select_rows('alan_relationship','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/relationship', $data);
		$this->template->publish();
	}
	public function deleterelationship()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_relationship','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">Relationship deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/relationship");
	}
	/*End Social Setting*/
	/*Life Style Setting*/
	public function diet()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Diet'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$dietdata=array("name"=>$this->input->post('diet'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_diet",$dietdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_diet",$dietdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/diet");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['dieteditdata']=$this->general_model->select_val("alan_diet","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_diet");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/diet/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['alldiet'] = $this->general_model->select_rows('alan_diet','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/diet', $data);
		$this->template->publish();
	}
	public function deletediet()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_diet','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">diet deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/diet");
	}
	public function smoke()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All smoke'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$smokedata=array("name"=>$this->input->post('smoke'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_smoke",$smokedata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_smoke",$smokedata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/smoke");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['smokeeditdata']=$this->general_model->select_val("alan_smoke","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_smoke");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/smoke/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['allsmoke'] = $this->general_model->select_rows('alan_smoke','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/smoke', $data);
		$this->template->publish();
	}
	public function deletesmoke()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_smoke','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">smoke deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/smoke");
	}
	public function drink()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All drink'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$drinkdata=array("name"=>$this->input->post('drink'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_drink",$drinkdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_drink",$drinkdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/drink");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['drinkeditdata']=$this->general_model->select_val("alan_drink","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_drink");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/drink/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['alldrink'] = $this->general_model->select_rows('alan_drink','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/drink', $data);
		$this->template->publish();
	}
	public function deletedrink()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_drink','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">drink deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/drink");
	}
	/*End Life Style Setting*/
	/*Professional Setting*/
	public function education_level()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All education level'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$education_leveldata=array("name"=>$this->input->post('education_level'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_education_level",$education_leveldata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_education_level",$education_leveldata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/education_level");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['education_leveleditdata']=$this->general_model->select_val("alan_education_level","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_education_level");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/education_level/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['alleducation_level'] = $this->general_model->select_rows('alan_education_level','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/education_level', $data);
		$this->template->publish();
	}
	public function deleteeducation_level()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_education_level','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">education_level deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/education_level");
	}
	public function education_field()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Education Field'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$education_fielddata=array("name"=>$this->input->post('education_field'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_education_field",$education_fielddata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_education_field",$education_fielddata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/education_field");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['education_fieldeditdata']=$this->general_model->select_val("alan_education_field","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_education_field");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/education_field/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['alleducation_field'] = $this->general_model->select_rows('alan_education_field','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/education_field', $data);
		$this->template->publish();
	}
	public function deleteeducation_field()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_education_field','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">education_field deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/education_field");
	}
	public function working_with()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Working Place'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$working_withdata=array("name"=>$this->input->post('working_with'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_working_with",$working_withdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_working_with",$working_withdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/working_with");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['working_witheditdata']=$this->general_model->select_val("alan_working_with","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_working_with");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/working_with/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['allworking_with'] = $this->general_model->select_rows('alan_working_with','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/working_with', $data);
		$this->template->publish();
	}
	public function deleteworking_with()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_working_with','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">working_with deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/working_with");
	}
	public function occupation()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Occupation'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$occupationdata=array("name"=>$this->input->post('occupation'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_occupation",$occupationdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_occupation",$occupationdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/occupation");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['occupationeditdata']=$this->general_model->select_val("alan_occupation","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_occupation");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/occupation/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['alloccupation'] = $this->general_model->select_rows('alan_occupation','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/occupation', $data);
		$this->template->publish();
	}
	public function deleteoccupation()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_occupation','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">occupation deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/occupation");
	}
	public function community()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Community'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$communitydata=array("name"=>$this->input->post('community'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_community",$communitydata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_community",$communitydata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/community");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['communityeditdata']=$this->general_model->select_val("alan_community","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_community");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/community/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['allcommunity'] = $this->general_model->select_rows('alan_community','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/community', $data);
		$this->template->publish();
	}
	public function deletecommunity()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_community','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">community deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/community");
	}
	public function annual_income()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Annual Income'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$annual_incomedata=array("name"=>$this->input->post('annual_income'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_annual_income",$annual_incomedata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_annual_income",$annual_incomedata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/annual_income");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['annual_incomeeditdata']=$this->general_model->select_val("alan_annual_income","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_annual_income");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/annual_income/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['allannual_income'] = $this->general_model->select_rows('alan_annual_income','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/annual_income', $data);
		$this->template->publish();
	}
	public function deleteannual_income()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_annual_income','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">annual_income deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/annual_income");
	}
	public function interested_in()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Interested In'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$interested_indata=array("name"=>$this->input->post('interested_in'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_interested_in",$interested_indata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_interested_in",$interested_indata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/interested_in");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['interested_ineditdata']=$this->general_model->select_val("alan_interested_in","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_interested_in");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/interested_in/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['allinterested_in'] = $this->general_model->select_rows('alan_interested_in','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/interested_in', $data);
		$this->template->publish();
	}
	public function deleteinterested_in()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_interested_in','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">interested_in deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/interested_in");
	}
	public function looking_meet()
	{
		$data['breadcrumb'] = set_crumbs(array(current_url() => 'All Looking Meet'));
		if($this->input->server('REQUEST_METHOD') === 'POST')
		{
			$looking_meetdata=array("name"=>$this->input->post('looking_meet'));
			if($this->input->post('id')=="")
			{
				$rid=$this->general_model->insert("alan_looking_meet",$looking_meetdata);
				$this->session->set_flashdata('message', '<p class="success">Added successfully</p>');
			}
			else
			{
				$this->general_model->update("alan_looking_meet",$looking_meetdata,"id = ".$this->input->post('id'));
				$this->session->set_flashdata('message', '<p class="success">update successfully</p>');
			}
			redirect(ADMIN_PATH . "/alan/looking_meet");
		}
		if(isset($_GET['id']))
		{
			$id=$_GET['id'];
			$data['looking_meeteditdata']=$this->general_model->select_val("alan_looking_meet","*","id = ".$id);
		}
		$count=$this->general_model->count_row("alan_looking_meet");
		$perpage = 10;
		if ($count > $perpage) 
		{
			$data['pagination']=$this->pagination($count,site_url(ADMIN_PATH . '/alan/looking_meet/'),$perpage);
			$offset = $this->uri->segment(4);
		}
		else
		{
			$offset=0;
			$data['pagination']=0;
		}
		$data['alllooking_meet'] = $this->general_model->select_rows('alan_looking_meet','*','id','ASC',$perpage,$offset);
		$this->template->content->view('admin/alan/looking_meet', $data);
		$this->template->publish();
	}
	public function deletelooking_meet()
	{
		if ($this->input->post('selected'))
        {
            $selected = $this->input->post('selected');
        }
        else
        {
            $selected = (array) $this->uri->segment(5);
        }
		$this->general_model->delete_rows('alan_looking_meet','id',$selected);
		$this->session->set_flashdata('message', '<p class="success">looking_meet deleted Successfully.</p>');
		redirect(ADMIN_PATH . "/alan/looking_meet");
	}
	/*End Professional Setting*/
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */